﻿using System.Linq;
using ReporterEngine;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using ReporterEngine.Model;
using System.Collections.Generic;

namespace ReportEngine_TestProject
{
    
    
    /// <summary>
    ///This is a test class for CIFModelTest and is intended
    ///to contain all CIFModelTest Unit Tests
    ///</summary>
    [TestClass()]
    public class CIFModelTest
    {


        private TestContext testContextInstance;

        /// <summary>
        ///Gets or sets the test context which provides
        ///information about and functionality for the current test run.
        ///</summary>
        public TestContext TestContext
        {
            get
            {
                return testContextInstance;
            }
            set
            {
                testContextInstance = value;
            }
        }

        #region Additional test attributes
        // 
        //You can use the following additional attributes as you write your tests:
        //
        //Use ClassInitialize to run code before running the first test in the class
        //[ClassInitialize()]
        //public static void MyClassInitialize(TestContext testContext)
        //{
        //}
        //
        //Use ClassCleanup to run code after all tests in a class have run
        //[ClassCleanup()]
        //public static void MyClassCleanup()
        //{
        //}
        //
        //Use TestInitialize to run code before running each test
        //[TestInitialize()]
        //public void MyTestInitialize()
        //{
        //}
        //
        //Use TestCleanup to run code after each test has run
        //[TestCleanup()]
        //public void MyTestCleanup()
        //{
        //}
        //
        #endregion


        /// <summary>
        ///A test for GetInstanceCategories
        ///</summary>
        [TestMethod()]
        public void GetInstanceCategoriesTest()
        {
            //var model = utils.GetSampleModel();

            CIFModel target = utils.GetSampleModel();

            List<InstanceCategory> expected = null; // TODO: Initialize to an appropriate value
            List<InstanceCategory> actual;
            
            actual = target.GetInstanceCategories();

            foreach(var c1 in actual)
            {
                foreach(InstanceNode instance1 in c1.Childs)
                {

                    foreach (var instanceCat in instance1.Categories)
                    {
                        //depends on category type
                        foreach(var catNode in instanceCat.Childs)
                        {
                            int ee = 12;
                        }
                    }
                }
            }
            
            Assert.AreEqual(76, actual.Count);
           // Assert.Inconclusive("Verify the correctness of this test method.");
        }

         /// <summary>
        ///A test for GetInstanceCategories
        ///</summary>
        [TestMethod()]
        public void IdNameCompareTest()
         {
             var comparer = new CIFModel.cifIDwithNameComparer();

             var x1 = new CIFModel.cifIDwithName();
             //x1.IDs.Add(new CIFModel.cifIDNode { IntValue = 2 });
             x1.IDs.Add(new CIFModel.cifIDNode { IntValue = 1 });
             x1.IDs.Add(new CIFModel.cifIDNode { IntValue = 20, IsAlpha = true, TextValue = "X" });


             var x = new CIFModel.cifIDwithName();
            x.IDs.Add(new CIFModel.cifIDNode { IntValue = 2 });
            x.IDs.Add(new CIFModel.cifIDNode { IntValue = 2 });
            x.IDs.Add(new CIFModel.cifIDNode { IntValue = 20, IsAlpha = true, TextValue = "X" });

             var y = new CIFModel.cifIDwithName();
             y.IDs.Add(new CIFModel.cifIDNode { IntValue = 1 });
             y.IDs.Add(new CIFModel.cifIDNode { IntValue = 2 });
             y.IDs.Add(new CIFModel.cifIDNode { IntValue = 20, IsAlpha = true, TextValue = "X" });
            
            List<CIFModel.cifIDwithName> data = new List<CIFModel.cifIDwithName>();

            data.Add(x1);
            data.Add(x);
             data.Add(y);

            data = data.OrderBy(u => u).ToList();

             int ee = 12;

         }
    }
}
